Skip to content

fix(playwright): warm search index + cap slow-test timeouts on Roles/Entity flakes - #30390

Merged
chirag-madlani merged 3 commits into
mainfrom
fix/playwright-roles-entity-slow-timeouts
Jul 24, 2026
Merged

chirag-madlani merged 3 commits into
mainfrom
fix/playwright-roles-entity-slow-timeouts

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two ~180 s timeout hangs consistently surface on postgresql-e2e:

  • `Pages/Roles.spec.ts › Roles page should work properly` (shard 1)
  • `Pages/Entity.spec.ts › User as Owner with unsorted list` (heaviest chromium shards)

Both declare `test.slow()` (180 s ceiling) and both pass in ~30–40 s on retry. All the waste is in how long the first attempt hangs before Playwright's per-test retry kicks in — 180 s / attempt in the worst case.

Root cause per test

Entity › User as Owner with unsorted list
The test creates two fresh users via API, then immediately drives the UI owner picker to search for them. Under CI load the async `user_search_index` lags creation by several seconds. The UI search returns empty and each `ownerItem.waitFor({state:'visible'})` inside `addMultiOwner` hangs 30 s. Two adds + a remove chain waste up to 90 s from one cold index — enough to push the whole test over the 180 s ceiling.

Roles › Roles page should work properly
The test runs 8 sequential `test.step` blocks, each renavigating to the roles list and calling `getElementWithPagination` (a 50-page loop with a 30 s loader wait per page). Under load the cumulative delays exceed 180 s.

Change

Entity.spec.ts — root-cause fix + insurance cap

  • Poll `/api/v1/search/query?q=&index=user_search_index` after both `OWNER1.create()` / `OWNER2.create()` return, waiting up to 15 s (500 ms → 2 s intervals) until both users appear. Subsequent UI searches now find them on the first click.
  • Cap `test.setTimeout(120_000)` instead of `test.slow()` so if any other hang mode remains, we fail at 2 min and let the retry recover with a fresh 120 s budget.

Roles.spec.ts — fail-fast cap only

  • Refactoring the 8 `test.step` blocks is out of scope for a flakiness PR. Cap `test.setTimeout(120_000)` (2× happy-path runtime) so a hung attempt fails at 2 min instead of 3.

Expected impact

Per flake occurrence:

Attempt 1 hang Attempt 2 (typical) Total wall time Savings
Before (with `test.slow()`) 180 s 30–40 s 210–220 s —
After (Entity, warmup works) 0 s (passes on 1st try) — 30–40 s ~180 s
After (fallback cap) 120 s 30–40 s 150–160 s ~60 s

Test plan

  • `Postgresql PR Playwright E2E Tests` on this PR: both tests pass, ideally on first attempt (Entity via warmup).
  • If Entity's warmup ever fails (search index never lands), it fails at 15 s inside `expect.poll` with a clear message rather than the opaque `Test timeout exceeded`.

Related

  • #30348 CustomProperties retry cascade (same effort, different flake pattern).

🤖 Generated with Claude Code

Greptile Summary

The PR reduces Playwright flake duration by warming the user search index before owner selection, imposing two-minute test ceilings, and replacing repeated Roles-list pagination with deterministic detail-page navigation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts Adds search-index readiness polling for newly created owners and replaces the slow-test multiplier with a 120-second timeout.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Roles.spec.ts Caps test duration and navigates directly to the generated role detail URL for repeated role operations.

Reviews (4): Last reviewed commit: "fix(playwright): poll user search index ..." | Re-trigger Greptile

Copilot AI review requested due to automatic review settings July 23, 2026 11:27
@chirag-madlani
chirag-madlani requested a review from a team as a code owner July 23, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jul 23, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 11:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chirag-madlani

Copy link
Copy Markdown
Collaborator Author

Amended with 2343d80527 per @madlanichirag's suggestion — direct-nav to the role detail page instead of paginating.

Four test.step blocks in Roles page should work properly were doing the same thing: navigate to roles list → paginate to find the row → click. The role URL is deterministic from roleName, so each hop becomes a single page.goto(/settings/access/roles/${roleName}).

  • Steps affected: 3 (edit description), 5 (add policy), 6 (remove policy), 7 (check last policy).
  • Steps left with pagination: 1 (verify role appears in list — the point of that assertion is the list view) and 8 (delete via list row's delete-action-<name> button).
  • Net: −37 lines, no new helpers, root cause of the pagination-loop-in-hang mode removed for the four affected steps.

Combined with the earlier test.setTimeout(120_000) cap this test should now consistently pass well under the ceiling on cold shards.

@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit c24ffcdce0a8d60c5708bdc40fba3b2732c7dc70 in Playwright run 30081575799, attempt 1.

✅ 399 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 43m 38s

⏱️ Max setup 1m 44s · max shard execution 14m 22s · max shard-job elapsed before upload 18m 31s · reporting 5s

🌐 214.23 requests/attempt · 3.28 app boots/UI scenario · 19.03% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 19.03% (convergence target: at most 15%).
  • Browser traffic was 214.23 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 3.28 per UI scenario (1389 boots / 423 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 85 0 0 0 0 0
🟡 Shard chromium-02 100 0 2 0 0 0
✅ Shard chromium-03 115 0 0 3 0 0
✅ Shard chromium-04 99 0 0 0 0 0
🟡 2 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard chromium-02, 1 retry)
  • Pages/Entity.spec.ts › User as Owner with unsorted list (shard chromium-02, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

chirag-madlani and others added 2 commits July 24, 2026 14:24
…Entity flakes

Two 180s test-timeout hangs surfaced repeatedly in postgresql-e2e — each
one burns 3 minutes of shard runtime per attempt before Playwright's
retry kicks in:

  Pages/Roles.spec.ts › Roles page should work properly    (shard 1)
  Pages/Entity.spec.ts › User as Owner with unsorted list  (shard 5/6)

Both tests declare test.slow() (=180s) and both consistently pass in
~30-40s on the retry attempt. The waste is entirely in how long each
attempt is allowed to hang before failing.

Entity › User as Owner with unsorted list — root-cause fix
  The test creates two fresh users via API, then immediately drives the
  UI owner picker to search for them. Under CI load the async
  user_search_index lags creation by several seconds; the UI search
  returns empty and each ownerItem.waitFor({visible}) inside
  addMultiOwner hangs the default 30s. Two adds + a remove chain that
  waste up to 90s from one cold index.

  Poll the search API up-front after user creation so both users are
  visible in the index before any UI search runs. Also cap the test at
  120s as insurance in case the warmup doesn't cover every hang mode.

Roles › Roles page should work properly — fail-fast cap
  This test runs 8 sequential test.step blocks, each renavigating to the
  roles list and calling getElementWithPagination (a 50-page loop with
  a 30s loader wait per page). Under load the cumulative delays push
  past 180s. Refactoring the 8 steps is out of scope; instead cap at
  120s so a hung attempt fails fast and the retry gets a fresh 120s
  budget, saving ~60s per flake occurrence.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…/5/6/7

Four test.step blocks in "Roles page should work properly" open the same
role's detail page. Each was doing:

  settingClick(page, ROLES)              // navigate to list
  waitForAllLoadersToDisappear(page)     // wait for list to render
  getElementWithPagination(roleLocator)  // 50-page loop, 30s loader wait
                                          // per page, clicks the row
  waitForAllLoadersToDisappear(page)     // wait for detail to render

This is pure ceremony — the URL is deterministic from roleName. Replace
each with a single page.goto(`/settings/access/roles/${roleName}`).

Step 1 (verify newly-created role appears in the roles list) and Step 8
(delete via the row's delete-action button) genuinely need the list
view and keep the pagination lookup.

Combined with the earlier timeout cap on this branch, the happy-path
runtime for this test drops significantly and the underlying source of
the 180s hang — repeated getElementWithPagination round-trips — is
removed for the four affected steps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 24, 2026 08:54
@chirag-madlani
chirag-madlani force-pushed the fix/playwright-roles-entity-slow-timeouts branch from 2343d80 to c24c647 Compare July 24, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chirag-madlani

Copy link
Copy Markdown
Collaborator Author

Rebased on latest main (which now includes #30310) → head c24c647942. Clean rebase, no conflicts.

  • Roles.spec.ts + utils/roles.ts were untouched by Fixes 28394: Cut Playwright CI shard runtime #30310 — our direct-nav fix (steps 3/5/6/7) and the 120s timeout cap on Roles page should work properly apply as-is.
  • Entity.spec.ts got small structural changes from Fixes 28394: Cut Playwright CI shard runtime #30310 (performAdminLogin → createAdminApiContext in beforeAll/afterAll, { storageState: undefined } on browser.newPage() calls) but those are around lines 94–140. Our edits at line ~244 (User as Owner with unsorted list warmup + timeout cap) are unaffected — test.slow(true) is still on main so the flake mode this PR fixes is still there.

Gitar-bot review on #30390 (comment 5068041851) noted that the warmup
polled by getUserName() (= responseData.name) but addMultiOwner drives
the picker with getUserDisplayName() (= responseData.displayName ?? name).
While those happen to match for users generated via generateRandomUsername
today, any future divergence would silently pass the warmup while the
UI search still misses — quietly reintroducing the 30s-per-op hang the
warmup was added to eliminate.

Switch both poll calls to getUserDisplayName() so we confirm the exact
term the picker searches is in the index.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 24, 2026 09:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chirag-madlani

Copy link
Copy Markdown
Collaborator Author

Addressed @gitar-bot's review in c24ffcdce0.

Confirmed the mapping (bot had the names swapped but the concern was real):

  • UserClass.getUserName() returns responseData.name
  • UserClass.getUserDisplayName() returns responseData.displayName ?? responseData.name

At line 292 and downstream (301, 311, 319) addMultiOwner / removeOwnersFromList / removeOwner all drive the picker with getUserDisplayName(). My warmup was polling getUserName() — coincidentally identical today for users generated via generateRandomUsername (no displayName set → falls back to name), but future divergence would let the warmup pass while the UI search still misses. Switched both poll calls to getUserDisplayName() so they cover the exact search term the picker uses.

@gitar-bot

gitar-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Addressed @gitar-bot's review in c24ffcdce0.

Confirmed the mapping (bot had the names swapped but the concern was real):

  • UserClass.getUserName() returns responseData.name
  • UserClass.getUserDisplayName() returns responseData.displayName ?? responseData.name

At line 292 and downstream (301, 311, 319) addMultiOwner / removeOwnersFromList / removeOwner all drive the picker with getUserDisplayName(). My warmup was polling getUserName() — coincidentally identical today for users generated via generateRandomUsername (no displayName set → falls back to name), but future divergence would let the warmup pass while the UI search still misses. Switched both poll calls to getUserDisplayName() so they cover the exact search term the picker uses.

Confirmed — checked UserClass directly and the mapping you describe is correct: getUserName() returns responseData.name, getUserDisplayName() returns responseData.displayName ?? responseData.name. The original finding had the accessor names swapped, but the underlying concern (warmup poll term vs. picker search term mismatch) was valid.

Verified c24ffcdce0 in Entity.spec.ts: both poll calls (lines 278, 281) now use getUserDisplayName(), matching the term used downstream by addMultiOwner/removeOwnersFromList/removeOwner at lines 296, 305, 315, 323. That closes the gap — the warmup now guarantees the index has the exact term the UI picker searches for, not just a value that happens to coincide today.

@chirag-madlani
chirag-madlani merged commit e90271c into main Jul 24, 2026
55 of 57 checks passed
@chirag-madlani
chirag-madlani deleted the fix/playwright-roles-entity-slow-timeouts branch July 24, 2026 11:31
@gitar-bot

gitar-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Warms the user search index before owner-picker operations and caps Playwright test timeouts to reduce CI flakiness, addressing the username versus display name polling finding. No issues found.

✅ 1 resolved
✅ Bug: Warm-up polls by username but UI searches display name

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts:272-275 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts:290 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Entity.spec.ts:299
The warm-up poll queries the search index with OWNER.getUserName() (responseData.displayName ?? name), while addMultiOwner later drives the picker with OWNER.getUserDisplayName() (responseData.name). When displayName and name diverge, confirming one is indexed does not guarantee the value the UI actually searches for is present, so the intended hang-elimination can silently fail. Poll with getUserDisplayName() so the warm-up covers the same term the picker searches, or assert both.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants